/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simframe.simulation;

/**
 *
 * @author Steve Noble
 */
public class SwarmMetric<E extends SimObject> {

    public SwarmMetric(String name, Metric.Units units, Compute<E> computer) {
        this.compute = computer;
        this.units = units;
        this.name = name;
    }
    final Compute<E> compute;

    private Metric.Constrain<E> constraint = null;
    private double[] numericalRange;
	private final String name;
    private final Metric.Units units;
    boolean avg = true;

    public double eval(E obj) {
        return compute.exec(obj);
    }
    public String getName() {
        return name;
    }

    public Metric.Units getUnits() {
        return units;
    }

    public double[] getNumericalRange() {
        return numericalRange;
    }

    public void setNumericalRange(double[] val) {
        numericalRange = val;
    }

    public void setConstraint(Metric.Constrain<E> constraint) {
        this.constraint = constraint;
    }

    public Metric.Constrain<E> getConstraint() {
        return constraint;
    }

    public void turnOffAveraging() {
        avg = false;
    }
}
